package com.briup.app02.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.briup.app02.bean.AccountCustomer;
import com.briup.app02.bean.AccountCustomerExample;
import com.briup.app02.bean.extend.AccountCustomerExtend;
import com.briup.app02.dao.AccountCustomerMapper;
import com.briup.app02.dao.extend.AccountCustomerExtendMapper;
import com.briup.app02.service.IAccountCustomerService;
@Service
public class AccountCustomerServiceImpl implements IAccountCustomerService{
	@Autowired
	private AccountCustomerMapper ac;
	
	@Autowired
	private AccountCustomerExtendMapper account; 
	@Override
	public List<AccountCustomer> findAll() {
		// TODO Auto-generated method stub
		return ac.selectByExample(new AccountCustomerExample());
	}

	@Override
	public void saveOrUpdate(AccountCustomer c1) {
		// TODO Auto-generated method stub
		if(c1.getId()==null) {
			ac.updateByExample(c1, new AccountCustomerExample());
		}else {
			ac.insert(c1);
		}
	}

	@Override
	public AccountCustomer findById(Long id) {
		// TODO Auto-generated method stub
		return ac.selectByPrimaryKey(id);
	}

	@Override
	public void delete(Long id) {
		// TODO Auto-generated method stub
		ac.deleteByPrimaryKey(id);
	}

	@Override
	public List<AccountCustomerExtend> pageQuery(int page, int pageSize, String status,String type,Long beginTime,Long endTime,Long user_id) {
		// TODO Auto-generated method stub
		int pageIndex=(page-1)*pageSize;
		List<AccountCustomerExtend> lists=account.pageQuery(pageIndex, pageSize, status, type, beginTime, endTime,user_id);
		return lists;
	}

}
